/*!  \file  Lock.h
 *	  \brief  
 * 
 *   \details   details
 *   \author    Yordan Madzhunkov German Research School for Simulation Sciences GmbH
 *   \version   1.0
 *   \date      07/13/2013 07:27:34 PM
 *   \copyright GNU Public License.
 */
#pragma once
class Lock {
public:
	Lock();
	virtual ~Lock();
	void lock()   {   lockMe(); };	
	bool tryLock(){ int res =  tryLockMe(); return res  == 0; };
	void unlock() { unlockMe(); };	
protected:
	int lockMe();
	int tryLockMe();
	int unlockMe();
#ifdef NOSPINLOCKS
	pthread_mutex_t    l;
#else
	pthread_spinlock_t l;
#endif
};
